import request from '@/utils/request'
import qs from 'qs'

/**
 * 获取打包活动列表
 * @param data
 */
export function packList(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/packAct/packList',
    method: 'post',
    data: data
  })
}

/**
 * 更新打包活动状态
 * @param data
 */
export function changePackActState(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/packAct/changePackActState',
    method: 'post',
    data: data
  })
}

/**
 * 删除打包活动
 * @param data
 */
export function deletePackAct(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/packAct/deletePackAct',
    method: 'post',
    data: data
  })
}

/**
 * 新增打包活动
 * @param data
 */
export function addPackAct(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/packAct/addPackAct',
    method: 'post',
    data: data
  })
}

/**
 * 获取打包活动详情
 * @param data
 */
export function detailPackAct(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/packAct/detailPackAct',
    method: 'post',
    data: data
  })
}

/**
 * 更新打包活动
 * @param data
 */
export function updatePackAct(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/packAct/updatePackAct',
    method: 'post',
    data: data
  })
}

/**
 * 获取打包活动打包商品统计信息
 * @param data
 */
export function packGoodsDetail(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/packAct/packGoodsDetail',
    method: 'post',
    data: data
  })
}

/**
 * 获取打包活动统计订单列表
 * @param data
 */
export function orderList(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/packAct/orderList',
    method: 'post',
    data: data
  })
}

/**
 * 获取抵扣金活动规则列表
 * @param data
 */
export function ruleList(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/ruleList',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

/**
 * 删除抵扣金活动规则
 * @param data
 */
export function deleteRule(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/deleteRule',
    method: 'post',
    data: data
  })
}

/**
 * 更新打包活动状态
 * @param data
 */
export function changeRuleState(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/changeRuleState',
    method: 'post',
    data: data
  })
}

/**
 * 获取抵扣金发放消耗统计信息
 * @param data
 */
export function summary() {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/summary',
    method: 'post'
  })
}

/**
 * 新增抵扣金活动规则
 * @param data
 */
export function addRule(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/addRule',
    method: 'post',
    data: data
  })
}

/**
 * 获取抵扣金活动规则详情
 * @param data
 */
export function detailRule(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/detailRule',
    method: 'post',
    data: data
  })
}

/**
 * 编辑抵扣金活动规则
 * @param data
 */
export function editRule(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/editRule',
    method: 'post',
    data: data
  })
}

/**
 * 获取抵扣金规则选项列表（用于下拉筛选抵扣金规则）
 * @param data
 */
export function ruleOptions(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/ruleOptions',
    method: 'post',
    data: data
  })
}

/**
 * 获取抵扣金活动规则用户统计列表
 * @param data
 */
export function ruleUserStatic(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/ruleUserStatic',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

/**
 * 获取抵扣金活动规则用户统计订单列表
 * @param data
 */
export function ruleUserStaticOrderList(data) {
  return request({
    url:
      'https://mockapi.eolinker.com/1RUIyUr58a7c491f47fa8963ed61e408db7c055d389eb37/marketDeduction/ruleUserStaticOrderList',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}
